import React,{useState,useEffect} from 'react';
function useSize(){
    let [size,setSize] = useState([window.innerWidth,window.innerHeight])

    const onResize = () => {
        setSize([window.innerWidth,window.innerHeight])
    }
    

    useEffect(() => {
        console.log("size",size)
        window.addEventListener('resize',onResize);
        return () => {
            window.removeEventListener('resize',onResize);
        }
    },[])

    useEffect(() => {
        console.log("===")
        document.title = size.join("x")
    },[size])
    return size
}

export default useSize